home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-STLport.exe / {app} / Samples / common / include / GL / glut.h
Encoding:
C/C++ Source or Header  |  2000-12-13  |  27.0 KB  |  717 lines

  1. #ifndef __glut_h__
  2. #define __glut_h__
  3.  
  4. /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
  5.  
  6. /* This program is freely distributable without licensing fees  and is
  7.    provided without guarantee or warrantee expressed or  implied. This
  8.    program is -not- in the public domain. */
  9.  
  10. #if defined(_WIN32)
  11.  
  12. /* GLUT 3.7 now tries to avoid including <windows.h>
  13.    to avoid name space pollution, but Win32's <GL/gl.h> 
  14.    needs APIENTRY and WINGDIAPI defined properly. */
  15. # if 0
  16.    /* This would put tons of macros and crap in our clean name space. */
  17. #  define  WIN32_LEAN_AND_MEAN
  18. #  include <windows.h>
  19. # else
  20.    /* XXX This is from Win32's <windef.h> */
  21. #  ifndef APIENTRY
  22. #   define GLUT_APIENTRY_DEFINED
  23. #   if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
  24. #    define APIENTRY    __stdcall
  25. #   else
  26. #    define APIENTRY
  27. #   endif
  28. #  endif
  29.    /* XXX This is from Win32's <winnt.h> */
  30. #  ifndef CALLBACK
  31. #   if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) || defined(__LCC__)
  32. #    define CALLBACK __stdcall
  33. #   else
  34. #    define CALLBACK
  35. #   endif
  36. #  endif
  37.    /* XXX Hack for lcc compiler.  It doesn't support __declspec(dllimport), just __stdcall. */
  38. #  if defined( __LCC__ )
  39. #   undef WINGDIAPI
  40. #   define WINGDIAPI __stdcall
  41. #  else
  42.    /* XXX This is from Win32's <wingdi.h> and <winnt.h> */
  43. #   ifndef WINGDIAPI
  44. #    define GLUT_WINGDIAPI_DEFINED
  45. #    define WINGDIAPI __declspec(dllimport)
  46. #   endif
  47. #  endif
  48.    /* XXX This is from Win32's <ctype.h> */
  49. #  ifndef _WCHAR_T_DEFINED
  50. typedef unsigned short wchar_t;
  51. #   define _WCHAR_T_DEFINED
  52. #  endif
  53. # endif
  54.  
  55. /* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
  56.    in your compile preprocessor options. */
  57. # if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
  58. #  pragma comment (lib, "winmm.lib")      /* link with Windows MultiMedia lib */
  59. /* To enable automatic SGI OpenGL for Windows library usage for GLUT,
  60.    define GLUT_USE_SGI_OPENGL in your compile preprocessor options.  */
  61. #  ifdef GLUT_USE_SGI_OPENGL
  62. #   pragma comment (lib, "opengl.lib")    /* link with SGI OpenGL for Windows lib */
  63. #   pragma comment (lib, "glu.lib")       /* link with SGI OpenGL Utility lib */
  64. #   pragma comment (lib, "glut.lib")      /* link with Win32 GLUT for SGI OpenGL lib */
  65. #  else
  66. #   pragma comment (lib, "opengl32.lib")  /* link with Microsoft OpenGL lib */
  67. #   pragma comment (lib, "glu32.lib")     /* link with Microsoft OpenGL Utility lib */
  68. #   pragma comment (lib, "glut32.lib")    /* link with Win32 GLUT lib */
  69. #  endif
  70. # endif
  71.  
  72. /* To disable supression of annoying warnings about floats being promoted
  73.    to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
  74.    options. */
  75. # ifndef GLUT_NO_WARNING_DISABLE
  76. #  pragma warning (disable:4244)  /* Disable bogus VC++ 4.2 conversion warnings. */
  77. #  pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */
  78. # endif
  79.  
  80. /* Win32 has an annoying issue where there are multiple C run-time
  81.    libraries (CRTs).  If the executable is linked with a different CRT
  82.    from the GLUT DLL, the GLUT DLL will not share the same CRT static
  83.    data seen by the executable.  In particular, atexit callbacks registered
  84.    in the executable will not be called if GLUT calls its (different)
  85.    exit routine).  GLUT is typically built with the
  86.    "/MD" option (the CRT with multithreading DLL support), but the Visual
  87.    C++ linker default is "/ML" (the single threaded CRT).
  88.  
  89.    One workaround to this issue is requiring users to always link with
  90.    the same CRT as GLUT is compiled with.  That requires users supply a
  91.    non-standard option.  GLUT 3.7 has its own built-in workaround where
  92.    the executable's "exit" function pointer is covertly passed to GLUT.
  93.    GLUT then calls the executable's exit function pointer to ensure that
  94.    any "atexit" calls registered by the application are called if GLUT
  95.    needs to exit.
  96.  
  97.    Note that the __glut*WithExit routines should NEVER be called directly.
  98.    To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
  99.  
  100. /* XXX This is from Win32's <process.h> */
  101. # if !defined(_MSC_VER) && !defined(__cdecl)
  102.    /* Define __cdecl for non-Microsoft compilers. */
  103. #  define __cdecl
  104. #  define GLUT_DEFINED___CDECL
  105. # endif
  106. # ifndef _CRTIMP
  107. #  ifdef _NTSDK
  108.     /* Definition compatible with NT SDK */
  109. #   define _CRTIMP
  110. #  else
  111.     /* Current definition */
  112. #   ifdef _DLL
  113. #    define _CRTIMP __declspec(dllimport)
  114. #   else
  115. #    define _CRTIMP
  116. #   endif
  117. #  endif
  118. #  define GLUT_DEFINED__CRTIMP
  119. # endif
  120.  
  121. /* GLUT API entry point declarations for Win32. */
  122. # ifdef GLUT_BUILDING_LIB
  123. #  define GLUTAPI __declspec(dllexport)
  124. # else
  125. #  ifdef _DLL
  126. #   define GLUTAPI __declspec(dllimport)
  127. #  else
  128. #   define GLUTAPI extern
  129. #  endif
  130. # endif
  131.  
  132. /* GLUT callback calling convention for Win32. */
  133. # define GLUTCALLBACK __cdecl
  134.  
  135. #endif  /* _WIN32 */
  136.  
  137. #include <GL/gl.h>
  138. #include <GL/glu.h>
  139.  
  140. #ifdef __cplusplus
  141. extern "C" {
  142. #endif
  143.  
  144. #if defined(_WIN32)
  145. # ifndef GLUT_BUILDING_LIB
  146. extern _CRTIMP void __cdecl exit(int);
  147. # endif
  148. #else
  149. /* non-Win32 case. */
  150. /* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */
  151. # define APIENTRY
  152. # define GLUT_APIENTRY_DEFINED
  153. # define CALLBACK
  154. /* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */
  155. # define GLUTAPI extern
  156. # define GLUTCALLBACK
  157. /* Prototype exit for the non-Win32 case (see above). */
  158. extern void exit(int);
  159. #endif
  160.  
  161. /**
  162.  GLUT API revision history:
  163.  
  164.  GLUT_API_VERSION is updated to reflect incompatible GLUT
  165.  API changes (interface changes, semantic changes, deletions,
  166.  or additions).
  167.  
  168.  GLUT_API_VERSION=1  First public release of GLUT.  11/29/94
  169.  
  170.  GLUT_API_VERSION=2  Added support for OpenGL/GLX multisampling,
  171.  extension.  Supports new input devices like tablet, dial and button
  172.  box, and Spaceball.  Easy to query OpenGL extensions.
  173.  
  174.  GLUT_API_VERSION=3  glutMenuStatus added.
  175.  
  176.  GLUT_API_VERSION=4  glutInitDisplayString, glutWarpPointer,
  177.  glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
  178.  video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
  179.  glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
  180.  glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
  181. **/
  182. #ifndef GLUT_API_VERSION  /* allow this to be overriden */
  183. #define GLUT_API_VERSION        3
  184. #endif
  185.  
  186. /**
  187.  GLUT implementation revision history:
  188.  
  189.  GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
  190.  API revisions and implementation revisions (ie, bug fixes).
  191.  
  192.  GLUT_XLIB_IMPLEMENTATION=1  mjk's first public release of
  193.  GLUT Xlib-based implementation.  11/29/94
  194.  
  195.  GLUT_XLIB_IMPLEMENTATION=2  mjk's second public release of
  196.  GLUT Xlib-based implementation providing GLUT version 2 
  197.  interfaces.
  198.  
  199.  GLUT_XLIB_IMPLEMENTATION=3  mjk's GLUT 2.2 images. 4/17/95
  200.  
  201.  GLUT_XLIB_IMPLEMENTATION=4  mjk's GLUT 2.3 images. 6/?/95
  202.  
  203.  GLUT_XLIB_IMPLEMENTATION=5  mjk's GLUT 3.0 images. 10/?/95
  204.  
  205.  GLUT_XLIB_IMPLEMENTATION=7  mjk's GLUT 3.1+ with glutWarpPoitner.  7/24/96
  206.  
  207.  GLUT_XLIB_IMPLEMENTATION=8  mjk's GLUT 3.1+ with glutWarpPoitner
  208.  and video resize.  1/3/97
  209.  
  210.  GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
  211.  
  212.  GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
  213.  
  214.  GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
  215.  
  216.  GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
  217.  
  218.  GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
  219.  
  220.  GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
  221. **/
  222. #ifndef GLUT_XLIB_IMPLEMENTATION  /* Allow this to be overriden. */
  223. #define GLUT_XLIB_IMPLEMENTATION    15
  224. #endif
  225.  
  226. /* Display mode bit masks. */
  227. #define GLUT_RGB            0
  228. #define GLUT_RGBA            GLUT_RGB
  229. #define GLUT_INDEX            1
  230. #define GLUT_SINGLE            0
  231. #define GLUT_DOUBLE            2
  232. #define GLUT_ACCUM            4
  233. #define GLUT_ALPHA            8
  234. #define GLUT_DEPTH            16
  235. #define GLUT_STENCIL            32
  236. #if (GLUT_API_VERSION >= 2)
  237. #define GLUT_MULTISAMPLE        128
  238. #define GLUT_STEREO            256
  239. #endif
  240. #if (GLUT_API_VERSION >= 3)
  241. #define GLUT_LUMINANCE            512
  242. #endif
  243.  
  244. /* Mouse buttons. */
  245. #define GLUT_LEFT_BUTTON        0
  246. #define GLUT_MIDDLE_BUTTON        1
  247. #define GLUT_RIGHT_BUTTON        2
  248.  
  249. /* Mouse button  state. */
  250. #define GLUT_DOWN            0
  251. #define GLUT_UP                1
  252.  
  253. #if (GLUT_API_VERSION >= 2)
  254. /* function keys */
  255. #define GLUT_KEY_F1            1
  256. #define GLUT_KEY_F2            2
  257. #define GLUT_KEY_F3            3
  258. #define GLUT_KEY_F4            4
  259. #define GLUT_KEY_F5            5
  260. #define GLUT_KEY_F6            6
  261. #define GLUT_KEY_F7            7
  262. #define GLUT_KEY_F8            8
  263. #define GLUT_KEY_F9            9
  264. #define GLUT_KEY_F10            10
  265. #define GLUT_KEY_F11            11
  266. #define GLUT_KEY_F12            12
  267. /* directional keys */
  268. #define GLUT_KEY_LEFT            100
  269. #define GLUT_KEY_UP            101
  270. #define GLUT_KEY_RIGHT            102
  271. #define GLUT_KEY_DOWN            103
  272. #define GLUT_KEY_PAGE_UP        104
  273. #define GLUT_KEY_PAGE_DOWN        105
  274. #define GLUT_KEY_HOME            106
  275. #define GLUT_KEY_END            107
  276. #define GLUT_KEY_INSERT            108
  277. #endif
  278.  
  279. /* Entry/exit  state. */
  280. #define GLUT_LEFT            0
  281. #define GLUT_ENTERED            1
  282.  
  283. /* Menu usage  state. */
  284. #define GLUT_MENU_NOT_IN_USE        0
  285. #define GLUT_MENU_IN_USE        1
  286.  
  287. /* Visibility  state. */
  288. #define GLUT_NOT_VISIBLE        0
  289. #define GLUT_VISIBLE            1
  290.  
  291. /* Window status  state. */
  292. #define GLUT_HIDDEN            0
  293. #define GLUT_FULLY_RETAINED        1
  294. #define GLUT_PARTIALLY_RETAINED        2
  295. #define GLUT_FULLY_COVERED        3
  296.  
  297. /* Color index component selection values. */
  298. #define GLUT_RED            0
  299. #define GLUT_GREEN            1
  300. #define GLUT_BLUE            2
  301.  
  302. #if defined(_WIN32)
  303. /* Stroke font constants (use these in GLUT program). */
  304. #define GLUT_STROKE_ROMAN        ((void*)0)
  305. #define GLUT_STROKE_MONO_ROMAN        ((void*)1)
  306.  
  307. /* Bitmap font constants (use these in GLUT program). */
  308. #define GLUT_BITMAP_9_BY_15        ((void*)2)
  309. #define GLUT_BITMAP_8_BY_13        ((void*)3)
  310. #define GLUT_BITMAP_TIMES_ROMAN_10    ((void*)4)
  311. #define GLUT_BITMAP_TIMES_ROMAN_24    ((void*)5)
  312. #if (GLUT_API_VERSION >= 3)
  313. #define GLUT_BITMAP_HELVETICA_10    ((void*)6)
  314. #define GLUT_BITMAP_HELVETICA_12    ((void*)7)
  315. #define GLUT_BITMAP_HELVETICA_18    ((void*)8)
  316. #endif
  317. #else
  318. /* Stroke font opaque addresses (use constants instead in source code). */
  319. GLUTAPI void *glutStrokeRoman;
  320. GLUTAPI void *glutStrokeMonoRoman;
  321.  
  322. /* Stroke font constants (use these in GLUT program). */
  323. #define GLUT_STROKE_ROMAN        (&glutStrokeRoman)
  324. #define GLUT_STROKE_MONO_ROMAN        (&glutStrokeMonoRoman)
  325.  
  326. /* Bitmap font opaque addresses (use constants instead in source code). */
  327. GLUTAPI void *glutBitmap9By15;
  328. GLUTAPI void *glutBitmap8By13;
  329. GLUTAPI void *glutBitmapTimesRoman10;
  330. GLUTAPI void *glutBitmapTimesRoman24;
  331. GLUTAPI void *glutBitmapHelvetica10;
  332. GLUTAPI void *glutBitmapHelvetica12;
  333. GLUTAPI void *glutBitmapHelvetica18;
  334.  
  335. /* Bitmap font constants (use these in GLUT program). */
  336. #define GLUT_BITMAP_9_BY_15        (&glutBitmap9By15)
  337. #define GLUT_BITMAP_8_BY_13        (&glutBitmap8By13)
  338. #define GLUT_BITMAP_TIMES_ROMAN_10    (&glutBitmapTimesRoman10)
  339. #define GLUT_BITMAP_TIMES_ROMAN_24    (&glutBitmapTimesRoman24)
  340. #if (GLUT_API_VERSION >= 3)
  341. #define GLUT_BITMAP_HELVETICA_10    (&glutBitmapHelvetica10)
  342. #define GLUT_BITMAP_HELVETICA_12    (&glutBitmapHelvetica12)
  343. #define GLUT_BITMAP_HELVETICA_18    (&glutBitmapHelvetica18)
  344. #endif
  345. #endif
  346.  
  347. /* glutGet parameters. */
  348. #define GLUT_WINDOW_X            ((GLenum) 100)
  349. #define GLUT_WINDOW_Y            ((GLenum) 101)
  350. #define GLUT_WINDOW_WIDTH        ((GLenum) 102)
  351. #define GLUT_WINDOW_HEIGHT        ((GLenum) 103)
  352. #define GLUT_WINDOW_BUFFER_SIZE        ((GLenum) 104)
  353. #define GLUT_WINDOW_STENCIL_SIZE    ((GLenum) 105)
  354. #define GLUT_WINDOW_DEPTH_SIZE        ((GLenum) 106)
  355. #define GLUT_WINDOW_RED_SIZE        ((GLenum) 107)
  356. #define GLUT_WINDOW_GREEN_SIZE        ((GLenum) 108)
  357. #define GLUT_WINDOW_BLUE_SIZE        ((GLenum) 109)
  358. #define GLUT_WINDOW_ALPHA_SIZE        ((GLenum) 110)
  359. #define GLUT_WINDOW_ACCUM_RED_SIZE    ((GLenum) 111)
  360. #define GLUT_WINDOW_ACCUM_GREEN_SIZE    ((GLenum) 112)
  361. #define GLUT_WINDOW_ACCUM_BLUE_SIZE    ((GLenum) 113)
  362. #define GLUT_WINDOW_ACCUM_ALPHA_SIZE    ((GLenum) 114)
  363. #define GLUT_WINDOW_DOUBLEBUFFER    ((GLenum) 115)
  364. #define GLUT_WINDOW_RGBA        ((GLenum) 116)
  365. #define GLUT_WINDOW_PARENT        ((GLenum) 117)
  366. #define GLUT_WINDOW_NUM_CHILDREN    ((GLenum) 118)
  367. #define GLUT_WINDOW_COLORMAP_SIZE    ((GLenum) 119)
  368. #if (GLUT_API_VERSION >= 2)
  369. #define GLUT_WINDOW_NUM_SAMPLES        ((GLenum) 120)
  370. #define GLUT_WINDOW_STEREO        ((GLenum) 121)
  371. #endif
  372. #if (GLUT_API_VERSION >= 3)
  373. #define GLUT_WINDOW_CURSOR        ((GLenum) 122)
  374. #endif
  375. #define GLUT_SCREEN_WIDTH        ((GLenum) 200)
  376. #define GLUT_SCREEN_HEIGHT        ((GLenum) 201)
  377. #define GLUT_SCREEN_WIDTH_MM        ((GLenum) 202)
  378. #define GLUT_SCREEN_HEIGHT_MM        ((GLenum) 203)
  379. #define GLUT_MENU_NUM_ITEMS        ((GLenum) 300)
  380. #define GLUT_DISPLAY_MODE_POSSIBLE    ((GLenum) 400)
  381. #define GLUT_INIT_WINDOW_X        ((GLenum) 500)
  382. #define GLUT_INIT_WINDOW_Y        ((GLenum) 501)
  383. #define GLUT_INIT_WINDOW_WIDTH        ((GLenum) 502)
  384. #define GLUT_INIT_WINDOW_HEIGHT        ((GLenum) 503)
  385. #define GLUT_INIT_DISPLAY_MODE        ((GLenum) 504)
  386. #if (GLUT_API_VERSION >= 2)
  387. #define GLUT_ELAPSED_TIME        ((GLenum) 700)
  388. #endif
  389. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
  390. #define GLUT_WINDOW_FORMAT_ID        ((GLenum) 123)
  391. #endif
  392.  
  393. #if (GLUT_API_VERSION >= 2)
  394. /* glutDeviceGet parameters. */
  395. #define GLUT_HAS_KEYBOARD        ((GLenum) 600)
  396. #define GLUT_HAS_MOUSE            ((GLenum) 601)
  397. #define GLUT_HAS_SPACEBALL        ((GLenum) 602)
  398. #define GLUT_HAS_DIAL_AND_BUTTON_BOX    ((GLenum) 603)
  399. #define GLUT_HAS_TABLET            ((GLenum) 604)
  400. #define GLUT_NUM_MOUSE_BUTTONS        ((GLenum) 605)
  401. #define GLUT_NUM_SPACEBALL_BUTTONS    ((GLenum) 606)
  402. #define GLUT_NUM_BUTTON_BOX_BUTTONS    ((GLenum) 607)
  403. #define GLUT_NUM_DIALS            ((GLenum) 608)
  404. #define GLUT_NUM_TABLET_BUTTONS        ((GLenum) 609)
  405. #endif
  406. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
  407. #define GLUT_DEVICE_IGNORE_KEY_REPEAT   ((GLenum) 610)
  408. #define GLUT_DEVICE_KEY_REPEAT          ((GLenum) 611)
  409. #define GLUT_HAS_JOYSTICK        ((GLenum) 612)
  410. #define GLUT_OWNS_JOYSTICK        ((GLenum) 613)
  411. #define GLUT_JOYSTICK_BUTTONS        ((GLenum) 614)
  412. #define GLUT_JOYSTICK_AXES        ((GLenum) 615)
  413. #define GLUT_JOYSTICK_POLL_RATE        ((GLenum) 616)
  414. #endif
  415.  
  416. #if (GLUT_API_VERSION >= 3)
  417. /* glutLayerGet parameters. */
  418. #define GLUT_OVERLAY_POSSIBLE           ((GLenum) 800)
  419. #define GLUT_LAYER_IN_USE        ((GLenum) 801)
  420. #define GLUT_HAS_OVERLAY        ((GLenum) 802)
  421. #define GLUT_TRANSPARENT_INDEX        ((GLenum) 803)
  422. #define GLUT_NORMAL_DAMAGED        ((GLenum) 804)
  423. #define GLUT_OVERLAY_DAMAGED        ((GLenum) 805)
  424.  
  425. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
  426. /* glutVideoResizeGet parameters. */
  427. #define GLUT_VIDEO_RESIZE_POSSIBLE    ((GLenum) 900)
  428. #define GLUT_VIDEO_RESIZE_IN_USE    ((GLenum) 901)
  429. #define GLUT_VIDEO_RESIZE_X_DELTA    ((GLenum) 902)
  430. #define GLUT_VIDEO_RESIZE_Y_DELTA    ((GLenum) 903)
  431. #define GLUT_VIDEO_RESIZE_WIDTH_DELTA    ((GLenum) 904)
  432. #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA    ((GLenum) 905)
  433. #define GLUT_VIDEO_RESIZE_X        ((GLenum) 906)
  434. #define GLUT_VIDEO_RESIZE_Y        ((GLenum) 907)
  435. #define GLUT_VIDEO_RESIZE_WIDTH        ((GLenum) 908)
  436. #define GLUT_VIDEO_RESIZE_HEIGHT    ((GLenum) 909)
  437. #endif
  438.  
  439. /* glutUseLayer parameters. */
  440. #define GLUT_NORMAL            ((GLenum) 0)
  441. #define GLUT_OVERLAY            ((GLenum) 1)
  442.  
  443. /* glutGetModifiers return mask. */
  444. #define GLUT_ACTIVE_SHIFT               1
  445. #define GLUT_ACTIVE_CTRL                2
  446. #define GLUT_ACTIVE_ALT                 4
  447.  
  448. /* glutSetCursor parameters. */
  449. /* Basic arrows. */
  450. #define GLUT_CURSOR_RIGHT_ARROW        0
  451. #define GLUT_CURSOR_LEFT_ARROW        1
  452. /* Symbolic cursor shapes. */
  453. #define GLUT_CURSOR_INFO        2
  454. #define GLUT_CURSOR_DESTROY        3
  455. #define GLUT_CURSOR_HELP        4
  456. #define GLUT_CURSOR_CYCLE        5
  457. #define GLUT_CURSOR_SPRAY        6
  458. #define GLUT_CURSOR_WAIT        7
  459. #define GLUT_CURSOR_TEXT        8
  460. #define GLUT_CURSOR_CROSSHAIR        9
  461. /* Directional cursors. */
  462. #define GLUT_CURSOR_UP_DOWN        10
  463. #define GLUT_CURSOR_LEFT_RIGHT        11
  464. /* Sizing cursors. */
  465. #define GLUT_CURSOR_TOP_SIDE        12
  466. #define GLUT_CURSOR_BOTTOM_SIDE        13
  467. #define GLUT_CURSOR_LEFT_SIDE        14
  468. #define GLUT_CURSOR_RIGHT_SIDE        15
  469. #define GLUT_CURSOR_TOP_LEFT_CORNER    16
  470. #define GLUT_CURSOR_TOP_RIGHT_CORNER    17
  471. #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER    18
  472. #define GLUT_CURSOR_BOTTOM_LEFT_CORNER    19
  473. /* Inherit from parent window. */
  474. #define GLUT_CURSOR_INHERIT        100
  475. /* Blank cursor. */
  476. #define GLUT_CURSOR_NONE        101
  477. /* Fullscreen crosshair (if available). */
  478. #define GLUT_CURSOR_FULL_CROSSHAIR    102
  479. #endif
  480.  
  481. /* GLUT initialization sub-API. */
  482. GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
  483. #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
  484. GLUTAPI void APIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
  485. #ifndef GLUT_BUILDING_LIB
  486. static void APIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
  487. #define glutInit glutInit_ATEXIT_HACK
  488. #endif
  489. #endif
  490. GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
  491. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
  492. GLUTAPI void APIENTRY glutInitDisplayString(const char *string);
  493. #endif
  494. GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
  495. GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
  496. GLUTAPI void APIENTRY glutMainLoop(void);
  497.  
  498. /* GLUT window sub-API. */
  499. GLUTAPI int APIENTRY glutCreateWindow(const char *title);
  500. #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
  501. GLUTAPI int APIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
  502. #ifndef GLUT_BUILDING_LIB
  503. static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
  504. #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
  505. #endif
  506. #endif
  507. GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
  508. GLUTAPI void APIENTRY glutDestroyWindow(int win);
  509. GLUTAPI void APIENTRY glutPostRedisplay(void);
  510. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
  511. GLUTAPI void APIENTRY glutPostWindowRedisplay(int win);
  512. #endif
  513. GLUTAPI void APIENTRY glutSwapBuffers(void);
  514. GLUTAPI int APIENTRY glutGetWindow(void);
  515. GLUTAPI void APIENTRY glutSetWindow(int win);
  516. GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
  517. GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
  518. GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
  519. GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
  520. GLUTAPI void APIENTRY glutPopWindow(void);
  521. GLUTAPI void APIENTRY glutPushWindow(void);
  522. GLUTAPI void APIENTRY glutIconifyWindow(void);
  523. GLUTAPI void APIENTRY glutShowWindow(void);
  524. GLUTAPI void APIENTRY glutHideWindow(void);
  525. #if (GLUT_API_VERSION >= 3)
  526. GLUTAPI void APIENTRY glutFullScreen(void);
  527. GLUTAPI void APIENTRY glutSetCursor(int cursor);
  528. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
  529. GLUTAPI void APIENTRY glutWarpPointer(int x, int y);
  530. #endif
  531.  
  532. /* GLUT overlay sub-API. */
  533. GLUTAPI void APIENTRY glutEstablishOverlay(void);
  534. GLUTAPI void APIENTRY glutRemoveOverlay(void);
  535. GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
  536. GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
  537. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
  538. GLUTAPI void APIENTRY glutPostWindowOverlayRedisplay(int win);
  539. #endif
  540. GLUTAPI void APIENTRY glutShowOverlay(void);
  541. GLUTAPI void APIENTRY glutHideOverlay(void);
  542. #endif
  543.  
  544. /* GLUT menu sub-API. */
  545. GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
  546. #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
  547. GLUTAPI int APIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
  548. #ifndef GLUT_BUILDING_LIB
  549. static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
  550. #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
  551. #endif
  552. #endif
  553. GLUTAPI void APIENTRY glutDestroyMenu(int menu);
  554. GLUTAPI int APIENTRY glutGetMenu(void);
  555. GLUTAPI void APIENTRY glutSetMenu(int menu);
  556. GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
  557. GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
  558. GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
  559. GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
  560. GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
  561. GLUTAPI void APIENTRY glutAttachMenu(int button);
  562. GLUTAPI void APIENTRY glutDetachMenu(int button);
  563.  
  564. /* GLUT window callback sub-API. */
  565. GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
  566. GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
  567. GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
  568. GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
  569. GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
  570. GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
  571. GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
  572. GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
  573. GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
  574. GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
  575. GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
  576. #if (GLUT_API_VERSION >= 2)
  577. GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
  578. GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
  579. GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
  580. GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
  581. GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
  582. GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
  583. GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
  584. GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
  585. #if (GLUT_API_VERSION >= 3)
  586. GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
  587. GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
  588. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
  589. GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
  590. #endif
  591. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
  592. GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
  593. GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
  594. GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
  595. #endif
  596. #endif
  597. #endif
  598.  
  599. /* GLUT color index sub-API. */
  600. GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
  601. GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
  602. GLUTAPI void APIENTRY glutCopyColormap(int win);
  603.  
  604. /* GLUT state retrieval sub-API. */
  605. GLUTAPI int APIENTRY glutGet(GLenum type);
  606. GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
  607. #if (GLUT_API_VERSION >= 2)
  608. /* GLUT extension support sub-API */
  609. GLUTAPI int APIENTRY glutExtensionSupported(const char *name);
  610. #endif
  611. #if (GLUT_API_VERSION >= 3)
  612. GLUTAPI int APIENTRY glutGetModifiers(void);
  613. GLUTAPI int APIENTRY glutLayerGet(GLenum type);
  614. #endif
  615.  
  616. /* GLUT font sub-API */
  617. GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
  618. GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
  619. GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
  620. GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
  621. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
  622. GLUTAPI int APIENTRY glutBitmapLength(void *font, const unsigned char *string);
  623. GLUTAPI int APIENTRY glutStrokeLength(void *font, const unsigned char *string);
  624. #endif
  625.  
  626. /* GLUT pre-built models sub-API */
  627. GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
  628. GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
  629. GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
  630. GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
  631. GLUTAPI void APIENTRY glutWireCube(GLdouble size);
  632. GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
  633. GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
  634. GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
  635. GLUTAPI void APIENTRY glutWireDodecahedron(void);
  636. GLUTAPI void APIENTRY glutSolidDodecahedron(void);
  637. GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
  638. GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
  639. GLUTAPI void APIENTRY glutWireOctahedron(void);
  640. GLUTAPI void APIENTRY glutSolidOctahedron(void);
  641. GLUTAPI void APIENTRY glutWireTetrahedron(void);
  642. GLUTAPI void APIENTRY glutSolidTetrahedron(void);
  643. GLUTAPI void APIENTRY glutWireIcosahedron(void);
  644. GLUTAPI void APIENTRY glutSolidIcosahedron(void);
  645.  
  646. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
  647. /* GLUT video resize sub-API. */
  648. GLUTAPI int APIENTRY glutVideoResizeGet(GLenum param);
  649. GLUTAPI void APIENTRY glutSetupVideoResizing(void);
  650. GLUTAPI void APIENTRY glutStopVideoResizing(void);
  651. GLUTAPI void APIENTRY glutVideoResize(int x, int y, int width, int height);
  652. GLUTAPI void APIENTRY glutVideoPan(int x, int y, int width, int height);
  653.  
  654. /* GLUT debugging sub-API. */
  655. GLUTAPI void APIENTRY glutReportErrors(void);
  656. #endif
  657.  
  658. #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
  659. /* GLUT device control sub-API. */
  660. /* glutSetKeyRepeat modes. */
  661. #define GLUT_KEY_REPEAT_OFF        0
  662. #define GLUT_KEY_REPEAT_ON        1
  663. #define GLUT_KEY_REPEAT_DEFAULT        2
  664.  
  665. /* Joystick button masks. */
  666. #define GLUT_JOYSTICK_BUTTON_A        1
  667. #define GLUT_JOYSTICK_BUTTON_B        2
  668. #define GLUT_JOYSTICK_BUTTON_C        4
  669. #define GLUT_JOYSTICK_BUTTON_D        8
  670.  
  671. GLUTAPI void APIENTRY glutIgnoreKeyRepeat(int ignore);
  672. GLUTAPI void APIENTRY glutSetKeyRepeat(int repeatMode);
  673. GLUTAPI void APIENTRY glutForceJoystickFunc(void);
  674.  
  675. /* GLUT game mode sub-API. */
  676. /* glutGameModeGet. */
  677. #define GLUT_GAME_MODE_ACTIVE           ((GLenum) 0)
  678. #define GLUT_GAME_MODE_POSSIBLE         ((GLenum) 1)
  679. #define GLUT_GAME_MODE_WIDTH            ((GLenum) 2)
  680. #define GLUT_GAME_MODE_HEIGHT           ((GLenum) 3)
  681. #define GLUT_GAME_MODE_PIXEL_DEPTH      ((GLenum) 4)
  682. #define GLUT_GAME_MODE_REFRESH_RATE     ((GLenum) 5)
  683. #define GLUT_GAME_MODE_DISPLAY_CHANGED  ((GLenum) 6)
  684.  
  685. GLUTAPI void APIENTRY glutGameModeString(const char *string);
  686. GLUTAPI int APIENTRY glutEnterGameMode(void);
  687. GLUTAPI void APIENTRY glutLeaveGameMode(void);
  688. GLUTAPI int APIENTRY glutGameModeGet(GLenum mode);
  689. #endif
  690.  
  691. #ifdef __cplusplus
  692. }
  693.  
  694. #endif
  695.  
  696. #ifdef GLUT_APIENTRY_DEFINED
  697. # undef GLUT_APIENTRY_DEFINED
  698. # undef APIENTRY
  699. #endif
  700.  
  701. #ifdef GLUT_WINGDIAPI_DEFINED
  702. # undef GLUT_WINGDIAPI_DEFINED
  703. # undef WINGDIAPI
  704. #endif
  705.  
  706. #ifdef GLUT_DEFINED___CDECL
  707. # undef GLUT_DEFINED___CDECL
  708. # undef __cdecl
  709. #endif
  710.  
  711. #ifdef GLUT_DEFINED__CRTIMP
  712. # undef GLUT_DEFINED__CRTIMP
  713. # undef _CRTIMP
  714. #endif
  715.  
  716. #endif                  /* __glut_h__ */
  717.